package com.tech.zhidengxian.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tech.zhidengxian.model.dataobject.AttentionDO;
import com.tech.zhidengxian.model.dataobject.CategoryDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author Ljh
 * @date 2023/5/14 13:32
 * @description 接口
 **/
@Mapper
public interface AttentionMapper extends BaseMapper<AttentionDO> {


    default AttentionDO queryByAtAndFans(AttentionDO attentionDO){
        LambdaQueryWrapper<AttentionDO> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(AttentionDO::getAttentionId,attentionDO.getAttentionId())
                .eq(AttentionDO::getFansId,attentionDO.getFansId())
                .eq(AttentionDO::getIsDeleted,false);
        return selectOne(wrapper);
    }

    default List<AttentionDO> queryListByUid(Long uid){
        LambdaQueryWrapper<AttentionDO> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(AttentionDO::getFansId, uid)
        .eq(AttentionDO::getIsDeleted,false);
        return selectList(wrapper);
    }
}
